#include<iostream>
#include<cstdio>
#include<algorithm>
#include<map>
#define int long long 
#define x first 
#define y second 
using namespace std;
map<char,int> mp;
void solve()
{
    string s;
    cin >> s;
    for(int i = 0; i < 3; i++)
    {
        mp[s[i]]++;
    }
    int t = 0;
    for(auto c:mp)
    {
        t = max(t , c.y);
    }
    cout << 3 - t << endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr),cout.tie(nullptr);
    int t = 1;
    while(t--) solve();
    return 0;
}
